home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Oct 26, 1998
- // Author: mt
- //
- // Procedure Name:
- // doCreateCharacterArgList
- //
- // Description:
- // Create a new character
- //
- // Input Arguments:
- // $version: The version of this option box. Used to know how to
- // interpret the $args array.
- // "1" : $name
- //
- // $args
- // Version 1
- // [0] $name : name to give the new character
- // Version 2
- // [0] $name : name to give the new character
- // [1] $excludeTranslate : exclude translate attrs when creating char
- // [2] $excludeRotate : exclude rotate attrs when creating char
- // [3] $excludeScale : exclude scale attrs when creating char
- // [4] $excludeVis : exclude visibility attrs when creating char
- // [5] $excludeDynamic : exclude dynamic attrs when creating char
- // [6] $channelBox : create based on channel box selections
- // Version 3
- // [7] $useHierarchy : use entire selected hierarchy
- //
- // Return Value:
- // None
- //
-
- global proc doCreateCharacterArgList( string $version, string $args[] )
- {
- string $name = $args[0];
- int $versionNo = $version;
- int $excludeTranslate = 0;
- int $excludeRotate = 0;
- int $excludeScale = 0;
- int $excludeVisibility = 0;
- int $excludeDynamic = 0;
- int $useChannelBox = 0;
- int $useHierarchy = 0;
- if ($versionNo > 1) {
- $excludeTranslate = $args[1];
- $excludeRotate = $args[2];
- $excludeScale = $args[3];
- $excludeVisibility = $args[4];
- $excludeDynamic = $args[5];
- $useChannelBox = $args[6];
- }
- if ($versionNo > 2) {
- $useHierarchy = $args[7];
- }
-
- string $currentSelection[] = `ls -selection`;
- if ($useHierarchy) {
- string $sel;
- $currentSelection = `ls -selection -dag -tr -ap`;
- for ($sel in $currentSelection) {
- if (nodeType($sel) != "ikEffector") {
- select -add $sel;
- }
- }
- }
-
- if ($useChannelBox) {
- string $attrs[] = `selectedChannelBoxPlugs`;
- select -r $attrs;
- }
-
- // Build the create character command
- //
- $cmd = ( "character -name \"" + $name + "\"");
-
- if ($excludeVisibility)
- $cmd += " -excludeVisibility";
- if ($excludeScale)
- $cmd += " -excludeScale";
- if ($excludeTranslate)
- $cmd += " -excludeTranslate";
- if ($excludeRotate)
- $cmd += " -excludeRotate";
- if ($excludeDynamic)
- $cmd += " -excludeDynamic";
-
- // Create the new character
- //
- string $character = evalEcho( $cmd );
-
- // Set the new character to be the current character on the highlight list
- //
- setCurrentCharacters( { $character } );
-
- // Put back the previous selection. We've put the character on
- // the highlight list, which is what we want
- //
- select -r $currentSelection;
-
- }
-